package com.lenovo.leos.filebrowser.netdisk;

import java.io.File;
import java.util.ArrayList;

import android.graphics.drawable.Drawable;

/** @author Steven Osborn - http://steven.bitsetters.com */
public class NetFileItem implements Comparable<NetFileItem>{
    
	private String mText = "";
	private Drawable mIcon;
	private NetFile Tfile = null;
	private  boolean isCut = false;
	private boolean isSysDir = false;
	public ArrayList<String> mPinyin = null;
	
	public NetFileItem(Drawable bullet,NetFile item, boolean isSysDir) {
		mIcon = bullet;
		mText = item.getName();
		Tfile = item;
		this.isSysDir = isSysDir;
	}
	
	public boolean isSysDir(){
		return isSysDir;
	}
	
	public NetFile getFile(){
		return this.Tfile;
	}

	public String getText() {
		return mText;
	}
	
	public void setTextPy(String sPy){
		String[] pyList = sPy.split(" ");
		if(mPinyin == null)
			mPinyin = new ArrayList<String>();
		
		for(int i=0; i<pyList.length; i++){
			mPinyin.add(pyList[i]);
		}
	}
	
	public int getPyCount(){
		if(mPinyin == null)
			return 0;
		
		return mPinyin.size();
	}
	
	public ArrayList<String> getAllPy(){
		return mPinyin;
	}
	
	public String getCharPy(int index){
		if(mPinyin == null || index >= mPinyin.size())
			return null;
		
		return mPinyin.get(index);
	}
	
	public void appendPy(String sPy){
		if(mPinyin == null)
			mPinyin = new ArrayList<String>();
		
		mPinyin.add(sPy);
	}
	
	public void setText(String text) {
		mText = text;
	}
	
	public void setIcon(Drawable icon) {
		mIcon = icon;
	}
	
	public Drawable getIcon() {
		return mIcon;
	}

	//@Override
	public int compareTo(NetFileItem other) {
		if(this.mText != null)
			return this.mText.compareTo(other.getText()); 
		else 
			throw new IllegalArgumentException();
	}
}

